<?php
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/factory/DaoFactory.php';
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/entity/BillDetail.php';
	
	error_reporting (E_ALL ^ E_NOTICE);
	
	$debug = $_SESSION['debug'];
	
	/*
	* Command to create a bill
	*/
	class CommandCreateBillDetail extends CustomCommand {
		/*
		* Constructor of the class
		*/
		public function __construct($pkLine, $units, $quantity, $unitCost, $pkFkNumberBill, 
			$pkFkControlNumberBill, $pkFkCodeProductInventory, $pkFkRifBranchInventory) {
			$this -> billDetail = new BillDetail($pkLine, $units, $quantity, $unitCost, 
				$pkFkNumberBill, $pkFkControlNumberBill, $pkFkCodeProductInventory, 
				$pkFkRifBranchInventory);
		}
		
		/*
		* Method to execute to create a bill detail
		*/
		public function execute() {
			$daoFactory = DaoFactory :: getMySqlDaoFactory();
			$ibdad = $daoFactory -> getMySqlBillDetailAccessDao();
			$billDetailCreation = $ibdad -> createBillDetail($this -> billDetail);
			
			$this -> result = $billDetailCreation;
		}
	}
?>